/*******************************************************************************************
 *  Fire.c
 *
 *  Creating and managing Fire object strucutres.
 *
 *******************************************************************************************/







/*******************************************************************************************
 *  INCLUDES :
 *******************************************************************************************/

/* System and library related : */
#include <stdlib.h>
#include <string.h>

/* Project related : */
#include "Fire.h"







/*******************************************************************************************
 *  FUNCTIONS :
 *******************************************************************************************/

/*******************************************************************************************
 *  NEWFIRE : Creates an empty Fire object structure.
 *******************************************************************************************/
Fire *newFire(void) {
	Fire *f;

	/* Creating the container structure : */
	f = (Fire *)malloc(sizeof(Fire));


	/* Setting the object's type : */
	f->otype = fire;


	/* Returning the still empty structure : */
	return f;

}




/*******************************************************************************************
 *  FREEFIRE : destroys a Fire object structure and all the objects it stores.
 *******************************************************************************************/
void freeFire(Fire *f) {

	if(f->direction != NULL)
		free(f->direction);

	if(f->speed != NULL)
		free(f->speed);

	//if(f->bullet != NULL)
	//	free(f->bullet);
	if(f->bulletRef != NULL)
		free(f->bulletRef);

	free(f);
}




/*******************************************************************************************
 *	SETFIRELABEL	 : assignes a label to a Fire object
 *  SETFIREDIRECTION : assignes a direction object to a Fire object
 *  SETFIRESPEED     : assignes a speed object to a Fire object
 *  SETFIREBULLET    : assignes a bullet object to a Fire object
 *  SETFIREBULLETREF : assignes a bulletRef object to a Fire object
 *******************************************************************************************/
void setFireLabel(Fire *f, char *l) {

	f->label = malloc(MAX_LABEL_LENGTH);

	strcpy(f->label, l);

}

void setFireDirection(Fire *f, Direction *d) {
	f->direction = d;
}

void setFireSpeed(Fire *f, Speed *s) {
	f->speed = s;
}

void setFireBullet(Fire *f, Bullet *b) {
	f->bullet = b;
}

void setFireBulletRef(Fire *f, BulletRef *br) {
	f->bulletRef = br;
}
